package com.example.tests;

public class ContactData implements Comparable<ContactData>{
	private String firstname;
	private String lastname;
	private String address;
	private String home_tel;
	private String mobile_tel;
	private String work_tel;
	private String email_1;
	private String email_2;
	private String bday;
	private String bmonth;
	private String byear;
	private String new_group;
	private String address2;
	private String phone2;
	private String id;

	public ContactData() {
	}
	
	public ContactData(String firstname, String lastname, String address,
			String home_tel, String mobile_tel, String work_tel,
			String email_1, String email_2, String bday, String bmonth,
			String byear, String new_group, String address2, String phone2) {
		this.firstname = firstname;
		this.lastname = lastname;
		this.address = address;
		this.home_tel = home_tel;
		this.mobile_tel = mobile_tel;
		this.work_tel = work_tel;
		this.email_1 = email_1;
		this.email_2 = email_2;
		this.bday = bday;
		this.bmonth = bmonth;
		this.byear = byear;
		this.new_group = new_group;
		this.address2 = address2;
		this.phone2 = phone2;
	}

	@Override
	public String toString() {
		return "ContactData [firstname=" + firstname + ", lastname=" + lastname
				+ ", address=" + address + ", home_tel=" + home_tel
				+ ", mobile_tel=" + mobile_tel + ", work_tel=" + work_tel
				+ ", email_1=" + email_1 + ", email_2=" + email_2 + ", bday="
				+ bday + ", bmonth=" + bmonth + ", byear=" + byear
				+ ", new_group=" + new_group + ", address2=" + address2
				+ ", phone2=" + phone2 + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((address == null) ? 0 : address.hashCode());
		result = prime * result
				+ ((address2 == null) ? 0 : address2.hashCode());
		result = prime * result + ((bday == null) ? 0 : bday.hashCode());
		result = prime * result + ((bmonth == null) ? 0 : bmonth.hashCode());
		result = prime * result + ((byear == null) ? 0 : byear.hashCode());
		result = prime * result + ((email_1 == null) ? 0 : email_1.hashCode());
		result = prime * result + ((email_2 == null) ? 0 : email_2.hashCode());
		result = prime * result
				+ ((firstname == null) ? 0 : firstname.hashCode());
		result = prime * result
				+ ((home_tel == null) ? 0 : home_tel.hashCode());
		result = prime * result
				+ ((lastname == null) ? 0 : lastname.hashCode());
		result = prime * result
				+ ((mobile_tel == null) ? 0 : mobile_tel.hashCode());
		result = prime * result + ((phone2 == null) ? 0 : phone2.hashCode());
		result = prime * result
				+ ((work_tel == null) ? 0 : work_tel.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactData other = (ContactData) obj;
		if (address == null) {
			if (other.address != null)
				return false;
		} else if (!address.equals(other.address))
			return false;
		if (address2 == null) {
			if (other.address2 != null)
				return false;
		} else if (!address2.equals(other.address2))
			return false;
		if (bday == null) {
			if (other.bday != null)
				return false;
		} else if (!bday.equals(other.bday))
			return false;
		if (bmonth == null) {
			if (other.bmonth != null)
				return false;
		} else if (!bmonth.equals(other.bmonth))
			return false;
		if (byear == null) {
			if (other.byear != null)
				return false;
		} else if (!byear.equals(other.byear))
			return false;
		if (email_1 == null) {
			if (other.email_1 != null)
				return false;
		} else if (!email_1.equals(other.email_1))
			return false;
		if (email_2 == null) {
			if (other.email_2 != null)
				return false;
		} else if (!email_2.equals(other.email_2))
			return false;
		if (firstname == null) {
			if (other.firstname != null)
				return false;
		} else if (!firstname.equals(other.firstname))
			return false;
		if (home_tel == null) {
			if (other.home_tel != null)
				return false;
		} else if (!home_tel.equals(other.home_tel))
			return false;
		if (lastname == null) {
			if (other.lastname != null)
				return false;
		} else if (!lastname.equals(other.lastname))
			return false;
		if (mobile_tel == null) {
			if (other.mobile_tel != null)
				return false;
		} else if (!mobile_tel.equals(other.mobile_tel))
			return false;
		if (phone2 == null) {
			if (other.phone2 != null)
				return false;
		} else if (!phone2.equals(other.phone2))
			return false;
		if (work_tel == null) {
			if (other.work_tel != null)
				return false;
		} else if (!work_tel.equals(other.work_tel))
			return false;
		return true;
	}

	@Override
	public int compareTo(ContactData other) {
		return this.lastname.toLowerCase().compareTo(other.lastname.toLowerCase()) ;
	}

	
//---------------------------------------------------------------------------------------------------
//getters  and setters (with)
//---------------------------------------------------------------------------------------------------
	// WITH
	public ContactData withFirstname(String firstname) {
		this.firstname = firstname;
		return this;
	}
	public ContactData withLastname(String lastname) {
		this.lastname = lastname;
		return this;
	}
	public ContactData withAddress(String address) {
		this.address = address;
		return this;
	}
	public ContactData withAddress2(String address2) {
		this.address2 = address2;
		return this;
	}
	public ContactData withHome_tel(String home_tel) {
		this.home_tel = home_tel;
		return this;
	}
	public ContactData withMobile_tel(String mobile_tel) {
		this.mobile_tel = mobile_tel;
		return this;
	}
	public ContactData withWork_tel(String work_tel) {
		this.work_tel = work_tel;
		return this;
	}
	public ContactData withEmail_1(String email_1) {
		this.email_1 = email_1;
		return this;
	}
	public ContactData withEmail_2(String email_2) {
		this.email_2 = email_2;
		return this;
	}
	public ContactData withPhone2(String phone2) {
		this.phone2 = phone2;
		return this;
	}
	public ContactData withByear(String byear) {
		this.byear = byear;
		return this;
	}
	public ContactData withBmonth(String bmonth) {
		this.bmonth = bmonth;
		return this;
	}
	public ContactData withBday(String bday) {
		this.bday = bday;
		return this;
	}

	public ContactData withId(String id) {
		this.id = id;
		return this;
	}
	
	// GETTERS
	public String getId() {
		return id;
	}
	
	public String getFirstname() {
		return firstname;
	}

	public String getLastname() {
		return lastname;
	}

	public String getAddress() {
		return address;
	}

	public String getHome_tel() {
		return home_tel;
	}

	public String getMobile_tel() {
		return mobile_tel;
	}

	public String getWork_tel() {
		return work_tel;
	}

	public String getEmail_1() {
		return email_1;
	}

	public String getEmail_2() {
		return email_2;
	}

	public String getBday() {
		return bday;
	}

	public String getBmonth() {
		return bmonth;
	}

	public String getByear() {
		return byear;
	}

	public String getNew_group() {
		return new_group;
	}

	public String getAddress2() {
		return address2;
	}

	public String getPhone2() {
		return phone2;
	}

	// SETTESRS
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setHome_tel(String home_tel) {
		this.home_tel = home_tel;
	}

	public void setMobile_tel(String mobile_tel) {
		this.mobile_tel = mobile_tel;
	}

	public void setWork_tel(String work_tel) {
		this.work_tel = work_tel;
	}

	public void setEmail_1(String email_1) {
		this.email_1 = email_1;
	}

	public void setEmail_2(String email_2) {
		this.email_2 = email_2;
	}

	public void setBday(String bday) {
		this.bday = bday;
	}

	public void setBmonth(String bmonth) {
		this.bmonth = bmonth;
	}

	public void setByear(String byear) {
		this.byear = byear;
	}

	public void setNew_group(String new_group) {
		this.new_group = new_group;
	}

	public void setAddress2(String address2) {
		this.address2 = address2;
	}

	public void setPhone2(String phone2) {
		this.phone2 = phone2;
	}

	public void setId(String id) {
		this.id = id;
	}
	
}